/* SetupRanking page controller */
(function () {
    'use strict';
    angular.module('module.business')
        .controller('CertificateController', CertificateController);

    CertificateController.$inject = ['$rootScope', '$scope', '$http', '$state', '$uibModal', '$uibModalInstance', '$log', '$document', '$uibPosition', '$interval', '$q'];

    function CertificateController($rootScope, $scope, $http, $state, $uibModal, $uibModalInstance, $log, $document, $uibPosition, $interval, $q) {
        var vm = this;

        vm.activate = activate;
        vm.certificatAward = certificatAward;
        vm.ok = ok;
        vm.cancel = cancel;

        vm.recordNo = '';

        //页面初始化
        activate();

        return vm;
        
        function certificatAward() {
            var modalInstance = $uibModal.open({
                animation: true,
                ariaLabelledBy: 'modal-title',
                ariaDescribedBy: 'modal-body',
                templateUrl: 'certificateAward.html',
                controller: 'CertificateAwardController',
                controllerAs: 'certificateAward',
                size: 'lg',
                resolve: {
                    recordNo: function(){
                        return vm.recordNo;
                    }
                }
            });
            modalInstance.result.then(function () {
                //doSomething
            }, function () {
                //doSomething
            });
        }

        function ok() {
            $uibModalInstance.close();
        }

        function cancel() {
            $uibModalInstance.dismiss('cancel');
        }

        /**
         * @description     页面初始化
         */
        function activate() {
            $scope.$on('$viewContentLoaded', function () {
                App.initAjax(); // initialize core components
            });

            $rootScope.settings.layout.pageContentWhite = true;
            $rootScope.settings.layout.pageBodySolid = true;
            $rootScope.settings.layout.pageSidebarClosed = false;
        }
    }
})();
